gtk-demo: Fix up some warnings
authorMatthias Clasen <mclasen@redhat.com>
Mon, 20 Jun 2016 02:47:57 +0000 (22:47 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 20 Jun 2016 02:47:57 +0000 (22:47 -0400)
The search entry example was a bit sloppy in cleaning up its
sources, causing warnings.

demos/gtk-demo/search_entry.c

index 67a10b5534c3c2622c440d9cefdb7c47a7ce836f..8573aa1e89b38afaede76fbbdbae98995d246ba8 100644 (file)
@@ -43,8 +43,11 @@ static gboolean
 finish_search (GtkButton *button)
 {
   show_find_button ();
-  g_source_remove (search_progress_id);
-  search_progress_id = 0;
+  if (search_progress_id)
+    {
+      g_source_remove (search_progress_id);
+      search_progress_id = 0;
+    }
   return G_SOURCE_REMOVE;
 }
 
@@ -71,7 +74,11 @@ static void
 stop_search (GtkButton *button,
              gpointer   data)
 {
-  g_source_remove (finish_search_id);
+  if (finish_search_id)
+    {
+      g_source_remove (finish_search_id);
+      finish_search_id = 0;
+    }
   finish_search (button);
 }